<?php

namespace App\Http\Controllers\Api\V1\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class AddressResource extends JsonResource
{
    public function toArray($request)
    {
    	$data = $this->resource;
    	
        return [
	        'id' 				=> (int)$data->id,
	        'user_id' 			=> (int)$data->user_id,
	        'id_code'           => (string)$data->id_code,
	        'id_name'           => (string)$data->id_name,
	        'province_code' 	=> $data->province_code,
	        'province' 			=> $data->province,
	        'city_code'         => $data->city_code,
	        'city' 				=> $data->city,
	        'district_code'     => $data->district_code,
	        'district' 			=> $data->district,
	        'address' 			=> $data->address,
	        'full_address' 		=> $data->full_address,
	        'contact_name' 	    => $data->contact_name,
	        'contact_phone' 	=> $data->contact_phone,
	        'is_default'        => (bool)$data->is_default,
	        'created_at' 		=> (string)$data->created_at,
        ];
    }
}
